package com.waijiaojun.tpo.repository;

import com.waijiaojun.tpo.entity.GoodsOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 通过@MapperScannerConfigurer扫描目录中的所有接口, 动态在Spring Context中生成实现.
 * 方法名称必须与Mapper.xml中保持一致.
 * 
 * @author peter
 */
@Component
@Mapper
public interface GoodsOrderDao {
	void save(GoodsOrder goodsOrder);
	void update(GoodsOrder goodsOrder);
	/**
	 * 软删除
	 */
	void delete(Long id);
	List<GoodsOrder> getAll();
	GoodsOrder getById(Long id);
	List<GoodsOrder> getByOpenid(String openid);
	/**
	 * 分页查询
	 * @param pageStart
	 * @param pageSize
	 * @return
	 */
	List<GoodsOrder> searchPage(@Param("goodsOrder") GoodsOrder goodsOrder, @Param("pageStart") int pageStart, @Param("pageSize") int pageSize);

	/**
	 * 分页查询总记录数
	 * @return
	 */
	Long searchCount(GoodsOrder goodsOrder);

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	/**
	 * 更新订单支付状态
	 * @param outTradeNo 订单编号
	 * @param payStatus 订单支付状态
	 * @return
	 */
	void updatePayStatus(@Param("outTradeNo") String outTradeNo, @Param("payStatus") Long payStatus);


	/**
	 * 根据订单编号查询订单及其详情
	 * @param orderCode 订单编号
	 * @return GoodsOrder 订单及其详情
	 */
	GoodsOrder getByOrderCode(String orderCode);

	/**
	 * 查询支付成功订单
	 * @param openid
	 * @return
	 */
    GoodsOrder getPayOrderByOpenid(@Param("openid")String openid);
}
